home *** CD-ROM | disk | FTP | other *** search
/ Sky at Night 2006 September / SAN CD 9-2006 CD-ROM 16.iso / pc / Software / Network Telescope Control / NTC-Setup.Exe / Source / ntc_client_about.pas < prev    next >
Encoding:
Pascal/Delphi Source File  |  2006-03-24  |  3.8 KB  |  195 lines

  1. unit ntc_client_about;
  2. {
  3.     Copyright (C) 2004 - 2006 Andrew Sprott
  4.  
  5.     http://astronomy.crysania.co.uk
  6.     astro@trefach.co.uk
  7.  
  8.     This program is free software; you can redistribute it and/or
  9.     modify it under the terms of the GNU General Public License
  10.     as published by the Free Software Foundation; either version 2
  11.     of the License, or (at your option) any later version.
  12.  
  13.     This program is distributed in the hope that it will be useful,
  14.     but WITHOUT ANY WARRANTY; without even the implied warranty of
  15.     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  16.     GNU General Public License for more details.
  17.  
  18.     You should have received a copy of the GNU General Public License
  19.     along with this program; if not, write to the Free Software
  20.     Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
  21. }
  22.  
  23. interface
  24.  
  25. uses
  26.     Windows,
  27.     Messages,
  28.     SysUtils,
  29.     Variants,
  30.     Classes,
  31.     Graphics,
  32.     Controls,
  33.     Forms,
  34.     Dialogs,
  35.     StdCtrls,
  36.     ExtCtrls,
  37.     inifiles,
  38.  
  39.     ntc_client_form;
  40.  
  41. type
  42.     Tscope_about = class(TForm)
  43.         about_panel: TPanel;
  44.         about_icon: TImage;
  45.         copyright_label_1: TLabel;
  46.         copyright_label_2: TLabel;
  47.         copyright_label_3: TLabel;
  48.         copyright_label_4: TLabel;
  49.         message_label_1: TLabel;
  50.         message_label_2: TLabel;
  51.         trefach_url_label: TLabel;
  52.     Label1: TLabel;
  53.     Label2: TLabel;
  54.     Image1: TImage;
  55.  
  56.         { methods }
  57.         procedure formcreate(
  58.             Sender:TObject);
  59.  
  60.         procedure FormShow(
  61.             Sender: TObject);
  62.  
  63.         procedure form_close_query(
  64.                     Sender: TObject;
  65.             var CanClose: Boolean);
  66.  
  67.         procedure adjust;
  68.  
  69.         procedure load_settings;
  70.  
  71.         procedure save_settings;
  72.  
  73.         procedure check_activate(
  74.             Sender: TObject);
  75.  
  76.     private
  77.         { Private declarations }
  78.     public
  79.         { Public declarations }
  80.         { configuration }
  81.         dimensions:dimensions_record;
  82.  
  83.         { events }
  84.         procedure check_visible_and_show_hide(
  85.             sender:tobject);
  86.             
  87.         procedure hide_form;
  88.         procedure show_form;
  89.     end;
  90.  
  91. var
  92.     scope_about: Tscope_about;
  93.  
  94. implementation
  95.  
  96. {$R *.dfm}
  97.  
  98. procedure tscope_about.formcreate(
  99.     Sender:TObject);
  100. begin
  101.     load_settings;
  102. end;
  103.  
  104. procedure Tscope_about.FormShow(
  105.     Sender: TObject);
  106. begin
  107.     with dimensions do
  108.         begin
  109.             top:=form_top;
  110.             left:=form_left;
  111.         end;
  112. end;
  113.  
  114. procedure tscope_about.form_close_query(
  115.             Sender: TObject;
  116.     var CanClose: Boolean);
  117. begin
  118.     canclose:=false;
  119.     visible:=false;
  120.     with dimensions do
  121.         begin
  122.             form_top:=top;
  123.             form_left:=left;
  124.         end;
  125. end;
  126.  
  127. procedure tscope_about.adjust;
  128. begin
  129.     with dimensions do
  130.         begin
  131.             form_top:=trunc(form_top/last_screen_height*current_height);
  132.             form_left:=trunc(form_left/last_screen_width*current_width);
  133.         end;
  134.     if visible then
  135.         show;
  136. end;
  137.  
  138. procedure tscope_about.check_visible_and_show_hide(
  139.     sender:tobject);
  140. begin
  141.     if visible then
  142.         hide_form
  143.     else
  144.         show_form;
  145.     scope.show_hide(sender,visible);
  146. end;
  147.  
  148. procedure tscope_about.hide_form;
  149. begin
  150.     with dimensions do
  151.         begin
  152.             form_top:=top;
  153.             form_left:=left;
  154.         end;
  155.     Visible:=false;
  156. end;
  157.  
  158. procedure tscope_about.show_form;
  159. begin
  160.     Visible:=true;
  161. end;
  162.  
  163. procedure tscope_about.load_settings;
  164. begin
  165.     ini_file:=tinifile.create(application_path+'client.ini');
  166.     with ini_file do
  167.         begin
  168.             { form }
  169.             scope.get_dimensions(scope_about,@dimensions,'about',ini_file);
  170.             left:=dimensions.form_left;
  171.             top:=dimensions.form_top;
  172.             visible:=readbool('about','visible',false);
  173.         end;
  174.     ini_file.free;
  175. end;
  176.  
  177. procedure tscope_about.save_settings;
  178. begin
  179.     with ini_file do
  180.         begin
  181.             { form }
  182.             scope.find_vdu(scope_about,@dimensions);
  183.             scope.write_dimensions(@dimensions,left,top,'about',ini_file);
  184.             writebool('about','visible',visible);
  185.         end;
  186. end;
  187.  
  188. procedure Tscope_about.check_activate(
  189.     Sender: TObject);
  190. begin
  191.     scope.form_activate(scope_about,@dimensions);
  192. end;
  193.  
  194. end.
  195.